﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WorkSoultionAdd.aspx.cs" Inherits="Page_日常工作_WorkSoultionAdd" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="/Com/JS/easyUi/themes/icon.css" rel="stylesheet" />
    <link href="/Com/JS/easyUi/themes/default/easyui.css" rel="stylesheet" />
    <link href="/Com/JS/formValidator/css/template.css" rel="stylesheet" />
    <link href="/Com/JS/formValidator/css/validationEngine.jquery.css" rel="stylesheet" />
    <link href="/Com/CSS/default.css" rel="stylesheet" />
    <script src="/Com/JS/jquery-1.8.2.js"></script>
    <script src="/Com/JS/easyUi/jquery.easyui.min.js"></script>
    <script src="/Com/JS/Common.js"></script>
    <script src="/Com/JS/jquery.form.js"></script>
    <script src="/Com/JS/formValidator/js/jquery.validationEngine.js"></script>
    <script src="/Com/JS/formValidator/js/languages/jquery.validationEngine-zh_CN.js"></script>
    <%--编辑器--%>
    <link href="/Com/KindEditor/themes/default/default.css" rel="stylesheet" />
    <link href="/Com/KindEditor/plugins/code/prettify.css" rel="stylesheet" />
    <script src="/Com/KindEditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="/Com/KindEditor/zh_CN.js"></script>
    <script src="/Com/KindEditor/plugins/code/prettify.js"></script>
    <script src="/Com/KindEditor/plugins/media/media.js"></script>
    <style>
        .imgAttchPic {
            border: #B3CCF2 1px solid;
            height: 100px;
            width: 100px;
        }

        fieldset {
            padding-bottom: 15px;
            border: solid 1px #ddd;
            margin-bottom: 5px;
        }

        .txt01 {
            padding: 3px 2px;
            width: 180px;
            height: 18px;
            line-height: 18px;
            border-right: solid 1px #e2e2e2;
            border-bottom: solid 1px #e2e2e2;
            border-top: solid 1px #ccc;
            border-left: solid 1px #ccc;
            color: #454545;
            padding-left: 8px;
        }

        .select01 {
            height: 24px;
            border-right: solid 1px #e2e2e2;
            border-bottom: solid 1px #e2e2e2;
            border-top: solid 1px #ccc;
            border-left: solid 1px #ccc;
            color: #454545;
            width: 190px;
        }

        a {
            color: #06c;
            text-decoration: none;
            blr: expression(this.onFocus=this.blur());
            hideFocus: trur;
        }

            a:focus {
                outline-style: none;
            }

            a:hover {
                text-decoration: underline;
            }
    </style>
    <script type="text/javascript">
        $().ready(function () {
            $("#formAddArticle").validationEngine();
            //发布文章表单
            var optionAddArticle = {
                dataType: 'text',
                beforeSubmit: showRequest,
                error: showError,
                success: showResponse
            };
            $('#formAddArticle').ajaxForm(optionAddArticle);
            //重置
            $("#btnReset").click(function () {
                window.location.reload();
            });
        });



        //初始化编辑器
        KindEditor.ready(function (K) {
            var editor = K.create('#txtArticleContent', {
                height: 350,
                minWidth: 590,
                width: 600,
                items: [
        'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste',
        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
        'justifyfull', '|', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|', 'subscript',
        'superscript', '|', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
        'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'insertfile', 'multiimage',
         'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
        'anchor', 'link', 'unlink'
                ]
,
                cssPath: '/Com/KindEditor/plugins/code/prettify.css',
                uploadJson: '/Handler/KindEditor_Upload.ashx?type=article',
                fileManagerJson: '/file_manager_json.ashx',
                allowFileManager: true,
                afterCreate: function () {
                    var self = this;
                    K.ctrl(document, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                }
            });

            var editor1 = K.create('#txtArticleContent1', {
                height: 350,
                minWidth: 590,
                width: 600,
                items: [
        'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste',
        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
        'justifyfull', '|', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|', 'subscript',
        'superscript', '|', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
        'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'insertfile', 'multiimage',
         'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
        'anchor', 'link', 'unlink'
                ]
,
                cssPath: '/Com/KindEditor/plugins/code/prettify.css',
                uploadJson: '/Handler/KindEditor_Upload.ashx?type=article',
                fileManagerJson: '/file_manager_json.ashx',
                allowFileManager: true,
                afterCreate: function () {
                    var self = this;
                    K.ctrl(document, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function () {
                        self.sync();
                        K('form[name=example]')[0].submit();
                    });
                }
            });
            //prettyPrint();
            //发布文章
            $("#btnAddArticle").click(function () {
                if ($("#formAddArticle").validationEngine('validate') == true) {
                    editor.sync();
                    editor1.sync();
                    $('#btnAddArticle').linkbutton('disable');
                    $("#formAddArticle").submit();
                }
                
            });

            $("#dialogShowReturnInfo").dialog({
                title: "信息反馈",
                width: 560,
                modal: true,
                height: 190,
                top: 150,
                buttons: [{
                    id: 'btnContinue',
                    text: '继续发布',
                    iconCls: 'icon-ok',
                    handler: function () {
                        window.location.reload();
                    }
                },
                    {
                        text: '返回列表',
                        iconCls: 'icon-back',
                        handler: function () {
                            BackPage();
                        }
                    },
                    {
                        text: '查看',
                        iconCls: 'icon-search',
                        handler: function () {
                            var _ArticleId = $("#hdArticleId").val();
                            var a = document.createElement("a");
                            a.target = "_blank";
                            a.href = "WorkSoultionDetial.aspx?IDPlus=" + _ArticleId ;
                            document.body.appendChild(a);
                            a.click()
                        }
                    }
                ],
                onClose: function () {
                    window.location.reload();
                }
            });




        });


        //表单提交前
        function showRequest(formData, jqForm, options) {
            return true;
        }
        //表单提交出错
        function showError(data) {
            $('#btnAddArticle').linkbutton('enable');
            alert('提交表单出错！');
        }

        //发布文章完成
        function showResponse(data, status) {
            var result = GetResult(data);
            if (result.IsSuccess) {
                var r = eval("(" + data + ")");
                $("#hdArticleId").val(r.ArticleId);
                $("#div_AddArticleMessage").append(result.Message);
                $("#dialogShowReturnInfo").dialog("open");
            } else {
                alert(result.Message);
            }
            $('#btnAddArticle').linkbutton('enable');
        }

        //返回列表
        function BackPage() {
            var subtitle = "问题解决";
            var url = "/Page/日常工作/WorkSoultion.aspx";
            if (self.parent.TabExists(subtitle)) {
                try {
                    self.parent.tempWin.refresh();
                }
                catch (err) {
                    var sourceTab = self.parent.refreshTab(subtitle);
                }
                self.parent.selectTab(subtitle, url);
            }
            else {
                self.parent.addTab(subtitle, url);
            }
            self.parent.sCloseTab("问题反馈");
        }
    </script>
</head>
<body style="background-color: white;">
    <div style="padding: 5px 10px;">
        <div style="width: 800px; float: left">
            <input id="hdArticleId" name="hdArticleId" value="" type="hidden" />
            <form id="formAddArticle" name="formAddArticle" action="/Handler/SoultionHandler.ashx?action=AddArticle"
                enctype="multipart/form-data" class="fm" method="post">
                <fieldset>
                    <legend>反馈信息</legend>
                    <table cellpadding="3" cellspacing="0" cellspacing="1" class="tb">
                        <tr>
                            <td class="tb_firsttd">问题类型</td>
                            <td class="tb_firsttd">
                                <select id="selectArticleType" name="selectArticleType" runat="server" class="select01">
                                    <option value="0">普通问题</option>
                                    <option value="1">严重问题</option>
                                </select>
                            </td>
                        </tr>

                        <tr>
                            <td class="tb_firsttd">标题：</td>
                            <td class="tb_secondtd" colspan="3">
                                <input id="txtArticleTitle" name="txtArticleTitle" type="text" class="txt01  validate[required]"
                                    style="width: 545px"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="tb_firsttd">问题详细：</td>
                            <td class="tb_secondtd" rowspan="6" colspan="3"></td>
                        </tr>
                    </table>
                    <div>
                        <div style="padding-left: 130px;">
                            <textarea id="txtArticleContent" name="txtArticleContent" cols="100" rows="8" style="width: 700px; visibility: hidden;"
                                runat="server" class="txt01  validate[required]"></textarea>
                        </div>
                    </div>
                    <table cellpadding="3" cellspacing="0" cellspacing="1" class="tb">
                        <tr>
                            <td class="tb_firsttd">解决方案：</td>
                            <td class="tb_secondtd" rowspan="6" colspan="3"></td>
                        </tr>

                    </table>
                    <div>
                        <div style="padding-left: 130px;">
                            <textarea id="txtArticleContent1" name="txtArticleContent1" cols="100" rows="8" style="width: 700px; visibility: hidden;"
                                runat="server" class="txt01  validate[required]"></textarea>
                        </div>
                    </div>
                </fieldset>
            </form>
            <div style="padding-left: 140px; margin: 10px">
                <a id="btnAddArticle" href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-add">问题反馈</a>
                <a id="btnReset" href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-add">重置</a>
            </div>
            <div id="dialogShowReturnInfo" class="easyui_dialog" style="padding: 10px 10px;" closed="true">
                <div id="div_AddArticleMessage">
                </div>
            </div>
        </div>
    </div>

</body>
</html>
